// BSC specific types
export interface BSCToken {
  id: string;
  launchId: number;
  tokenAddress: string;
  creator: string;
  name: string;
  symbol: string;
  description: string;
  website?: string;
  telegram?: string;
  twitter?: string;
  imageUrl?: string;
  
  // Launch parameters
  targetAmount: string; // in BNB
  raisedAmount: string; // in BNB
  createdAt: number;
  deadline: number;
  
  // Status
  launched: boolean;
  cancelled: boolean;
  
  // Bonding curve info
  currentPrice: string; // Current token price in BNB
  tokensSold: string; // Number of tokens sold
  totalSupplyForSale: string; // Total tokens available for sale
  
  // Trading info
  priceChange24h?: number | null;
  volume24h?: string;
  marketCap?: string;
  holders?: number;
  
  // User specific
  userBalance?: string; // User's token balance
  userContribution?: string; // User's BNB contribution
}

export interface BSCLaunchInfo {
  tokenAddress: string;
  creator: string;
  name: string;
  symbol: string;
  description: string;
  targetAmount: string;
  raisedAmount: string;
  deadline: number;
  launched: boolean;
  cancelled: boolean;
  currentPrice: string;
  tokensSold: string;
  totalSupplyForSale: string;
}

export interface BSCContribution {
  launchId: number;
  contributor: string;
  amount: string; // BNB amount
  tokensReceived: string;
  timestamp: number;
  txHash: string;
}

export interface BSCStats {
  totalTokens: number;
  totalVolume: string; // in BNB
  activeTraders: number;
  totalLaunches: number;
  successfulLaunches: number;
  averageRaise: string;
}

// Trading related types
export interface BSCTradeParams {
  launchId: number;
  amount: string; // BNB amount for buying, token amount for selling
  slippage?: number; // percentage
  tradeType: 'buy' | 'sell';
}

export interface BSCTradeResult {
  success: boolean;
  txHash?: string;
  tokensReceived?: string; // For buy
  bnbReceived?: string; // For sell
  bnbSpent?: string; // For buy
  newPrice?: string;
  error?: string;
}

// Preview types
export interface BSCBuyPreview {
  tokensReceived: string;
  newPrice: string;
  priceImpact: number;
}

export interface BSCSellPreview {
  bnbReceived: string;
  newPrice: string;
  priceImpact: number;
}

// Contract interaction types
export interface BSCContractConfig {
  launchPadAddress: string;
  pancakeRouterAddress: string;
  rpcUrl: string;
  chainId: number;
  blockExplorer: string;
}

// WebSocket events
export interface BSCWebSocketEvents {
  tokenCreated: BSCToken;
  tokenUpdated: Partial<BSCToken> & { id: string };
  tokenPurchase: BSCContribution;
  tokenSale: BSCContribution;
  tokenGraduated: { launchId: number; pairAddress: string };
  statsUpdated: BSCStats;
}

// Form types
export interface CreateBSCTokenParams {
  name: string;
  symbol: string;
  description: string;
  website?: string;
  telegram?: string;
  twitter?: string;
  targetAmount: string; // BNB
  imageFile?: File;
}

// Price chart data
export interface BSCPriceData {
  timestamp: number;
  price: number; // in BNB
  volume: number; // in BNB
  tokensSold: number;
}

export interface BSCChartData {
  prices: BSCPriceData[];
  volume: BSCPriceData[];
  period: '1h' | '24h' | '7d' | '30d';
}

// Bonding curve specific
export interface BSCBondingCurveData {
  basePrice: string; // Starting price
  priceIncrement: string; // Price increment per token
  tokensForCurve: string; // Tokens available on curve
  tokensForLiquidity: string; // Tokens reserved for liquidity
  currentSupply: string; // Current tokens in circulation
}

export interface BSCLiquidityInfo {
  bnbAmount: string;
  tokenAmount: string;
  lpTokens: string;
  pairAddress: string;
}